package JVM.oom;

import java.nio.ByteBuffer;

// Exception in thread "main" java.lang.OutOfMemoryError: Direct buffer memory

public class DirectBufferMemoryDemo {

    public static void main(String[] args) {
        System.out.println("可配置的MaxDirectMemorySize" +
                (sun.misc.VM.maxDirectMemory() / (double)1024 / 1024));

        ByteBuffer buffer = ByteBuffer.allocateDirect(6 * 1024 * 1024);
    }
}
